﻿#pragma once
struct GUIBORDER_D3DVERTEX
{
	float VertexID;		// 顶点标识
};

class CGuiBorder
{
private:
	LPDIRECT3DVERTEXBUFFER9       m_pVB;                // 顶点缓冲区
	LPDIRECT3DINDEXBUFFER9        m_pIB;                // 顶点缓冲区指针
	DWORD                         m_dwNumVertices;      // 顶点个数
	LPDIRECT3DVERTEXDECLARATION9  m_pDecl;              // 顶点声明接口
	LPD3DXEFFECT                  m_pEffect;            // 效果接口

	int m_nOffsetX;
	int m_nOffsetY;
	int m_nWidth;
	int m_nHeight;

public:
	CGuiBorder();
	~CGuiBorder();
	
	HRESULT OnCreateDevice(IDirect3DDevice9* pd3dDevice);
	HRESULT OnResetDevice(IDirect3DDevice9* pd3dDevice);
	void    OnFrameMove();
	void	OnFrameRender(IDirect3DDevice9* pd3dDevice);
	void	OnLostDevice();
	void	OnDestroyDevice();

	void	SetBorder(int nOffsetX, int nOffsetY, int nWidth, int nHeight);
	bool	IsRender();

private:
	HRESULT CreateSquare(LPDIRECT3DDEVICE9 pd3dDevice);
};